﻿function AjaxDO(){ 
	this.http_request = false;
	this.DivObj = null;
	this.waitstate = null;
	this.success = null;

	this.Get = function (divid,url) {
	
		this.http_request = false;
		this.DivObj = document.getElementById(divid);
		if(window.XMLHttpRequest) { //Mozilla 浏览器
			this.http_request = new XMLHttpRequest();
			if (this.http_request.overrideMimeType) {//设置MiME类别
				this.http_request.overrideMimeType('text/xml');
			}
		}else if (window.ActiveXObject) { // IE浏览器
			try {
				this.http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					this.http_request = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
		}
		if (!this.http_request) {
			window.alert("不能创建XMLHttpRequest对象实例.");
			return false;
		}
		this.http_request.onreadystatechange = this.processRequest;
		this.http_request.open("GET", url+"&"+Math.random(), true);
		this.http_request.send(null);
	}
	
    this.processRequest = function () {
        if (this.http_request.readyState == 4) 
		{
            if (this.http_request.status == 200) 
			{
				if(this.DivObj!=null)
				{
					this.DivObj.innerHTML=this.http_request.responseText;
				}
            } else 
			{
                alert("您所请求的页面有异常。");
            }
        }else
		{
			if(this.DivObj!=null)
			{
				this.DivObj.innerHTML='请等待...';
			}
		}
    }	
	
}	